//
//  SDCourseViewController.swift
//  Seed
//
//  Created by Samuel on 2017/6/5.
//  Copyright © 2017年 RedSoft. All rights reserved.
//

import UIKit

class SDCourseViewController: YMBaseViewController,UITableViewDelegate,UITableViewDataSource {

    private var tableView:UITableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        configUI()
    }
    
    func configUI(){
        // Do any additional setup after loading the view.
        tableView = UITableView.init(frame: self.view.bounds)
        tableView.delegate = self
        tableView.dataSource = self
        tableView.separatorStyle = .none
        tableView.backgroundColor = YMGlobalColor()
        self.view.addSubview(tableView)
        tableView.register(UINib.init(nibName: "SDCourseCell", bundle: nil), forCellReuseIdentifier: "SDCourseCell")
        
        let titleView = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 120, height: 20))
        titleView.setImage(#imageLiteral(resourceName: "course_selected"), for: .normal)
        titleView.setTitle("Seed·课程", for: .normal)
        titleView.setTitleColor(YMGlobalRedColor(), for: .normal)
        titleView.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0)
        titleView.isUserInteractionEnabled = false
        self.navigationItem.titleView = titleView
        navigationItem.rightBarButtonItem = UIBarButtonItem.init(image: #imageLiteral(resourceName: "listening"), style: .plain, target: self, action: #selector(listenClick))
    }
    
    //#MARK: Private Method
    func listenClick() {
        
    }


    //#MARK: UITableViewDataSource
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 3
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "SDCourseCell") as! SDCourseCell
        return cell
    }

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 206
    }
}
